<?php Yii::app()->clientScript->registerScriptFile(Yii::app()->theme->baseUrl.'/js/form-validator.js',CClientScript::POS_HEAD)?>
<?php
/* @var $this BackendController */
/* @var $model Category */
/* @var $form CActiveForm */
?>

<div class="form">

<?php $form=$this->beginWidget('TActiveForm', array(
	'id'=>'category-form',
    'method'=>'post',
	// Please note: When you enable ajax validation, make sure the corresponding
	// controller action is handling ajax validation correctly.
	// There is a call to performAjaxValidation() commented in generated controller code.
	// See class documentation of CActiveForm for details on this.
    'enableAjaxValidation'=>true,
    'enableClientValidation'=>true,
    'clientOptions'=>array(
        'afterValidate'=>'js:afterValidate',
        'validateOnSubmit'=>true,
        'validateOnType'=>true,
        'validateOnChange'=>true,
        'hideErrorMessage'=>true
    ),
)); ?>

	<p class="note"><?php echo Yii::t('CategoryModule.base','Fields with') ?><span class="required"> * </span><?php echo Yii::t('CategoryModule.base','are required.') ?></p>

	<div class="input-group">
		<?php echo $form->labelTb($model,'name'); ?>
		<?php echo $form->textFieldTb($model,'name',array('size'=>50,'maxlength'=>255)); ?>
        <?php echo $form->error($model,'name',array('afterValidateAttribute'=>'js:afterValidateAttribute')); ?>
	</div>

	<div class="input-group">
		<?php echo $form->labelTb($model,'tags'); ?>
		<?php echo $form->textAreaTb($model,'tags',array('rows'=>6, 'cols'=>50)); ?>
        <?php echo $form->error($model,'tags',array('afterValidateAttribute'=>'js:afterValidateAttribute')); ?>
	</div>


	<div class="row buttons">
		<?php echo CHtml::submitButton($model->isNewRecord ? Yii::t('CategoryModule.base','Create') : Yii::t('CategoryModule.base','Save'),array('class'=>'btn btn-default')); ?>
	</div>

<?php $this->endWidget(); ?>

</div><!-- form -->